<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>FCKEditingArea Test</title>
   	<script type="text/javascript">

// Used by fckconfig
var FCK = new Object() ;

	</script>
	<script src="../../../editor/_source/fckconstants.js" type="text/javascript"></script>
	<script src="../../../editor/_source/fckjscoreextensions.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckregexlib.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckbrowserinfo.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckiecleanup.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fckconfig.js" type="text/javascript"></script>
	<script src="../../../fckconfig.js" type="text/javascript"></script>
	<script src="../../../editor/_source/internals/fcktools.js" type="text/javascript"></script>
	<script src="../../../editor/_source/classes/fckeditingarea.js" type="text/javascript"></script>
	<script type="text/javascript">

function LoadScript( url )
{
	document.write( '<script type="text/javascript" src="' + url + '"><\/script>' ) ;
}
var sSuffix = /msie/.test( navigator.userAgent.toLowerCase() ) ? 'ie' : 'gecko' ;
LoadScript( '../../../editor/_source/internals/fcktools_' + sSuffix + '.js' ) ;

	</script>
	<script type="text/javascript">

if ( FCKBrowserInfo.IsIE )
	FCK.IECleanup = new FCKIECleanup( window ) ;

var oEditingArea ;

window.onload = function()
{
	oEditingArea = new FCKEditingArea( document.getElementById( 'xTarget' ) ) ;
	SetHtml() ;
}

function SetHtml()
{
	oEditingArea.Mode = document.getElementById( 'xChkWYSIWYG' ).checked ? FCK_EDITMODE_WYSIWYG : FCK_EDITMODE_SOURCE ;
	oEditingArea.Start( BuildHtml() ) ;
	Focus() ;
}

function Focus()
{
	oEditingArea.Focus() ;
}

function BuildHtml()
{
	var sBasePath = document.location.pathname.replace( /_test\/.*$/, '' ) ;
	sBasePath = document.location.protocol + '//' + document.location.host + sBasePath ;

	var _BehaviorsStyle = '<style type="text/css" _fcktemp="true">' ;

	_BehaviorsStyle += 'TABLE { behavior: url(' + sBasePath + 'editor/css/behaviors/showtableborders.htc) ; }' ;

	// Disable resize handlers.
	var sNoHandlers = 'INPUT, TEXTAREA, SELECT, .FCK__Anchor, .FCK__PageBreak' ;

	_BehaviorsStyle += sNoHandlers + ' { behavior: url(' + sBasePath + 'editor/css/behaviors/disablehandles.htc) ; }' ;

	_BehaviorsStyle += '</style>' ;

	var sHtml = '' ;

	sHtml += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ;

	if ( FCKBrowserInfo.IsIE )
		sHtml += '<html dir="ltr" style="overflow-y: scroll">' ;
	else
		sHtml += '<html dir="ltr">' ;

	sHtml += '<head><title></title><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>' ;
	sHtml += '<link href="../../../editor/css/fck_editorarea.css" rel="stylesheet" type="text/css" />' ;
	sHtml += '<link href="../../../editor/css/fck_internal.css" rel="stylesheet" type="text/css" />' ;

	if ( FCKBrowserInfo.IsIE )
		sHtml += _BehaviorsStyle ;
	else
		sHtml += '<link href="../../../editor/css/fck_showtableborders_gecko.css" rel="stylesheet" type="text/css" />' ;

	sHtml += '<base href="http://www.fckeditor.net"></base>' ;
	sHtml += '</head><body>' ;
	sHtml += document.getElementById( 'xSource' ).value ;
	sHtml += '</body></html>' ;

	return sHtml ;
}

function ShowHtml()
{
	alert( oEditingArea.Document.getElementsByTagName( 'html' )[0].innerHTML ) ;
}

	</script>
	<script type="text/javascript">



	</script>
</head>
<body>
	<table width="100%" style="height: 90%" cellpadding="0" cellspacing="0">
		<tr>
			<td id="xTarget" style="height: 100%; border: #000000 1px solid;">
			</td>
		</tr>
		<tr>
			<td>
				<hr />
				<textarea id="xSource" cols="5" rows="80" style="width: 100%; height: 100px;">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;FCKeditor&lt;/a&gt;.&lt;table height="50%" border="0"&gt;&lt;tr&gt;&lt;td&gt;Cel 1&lt;/td&gt;&lt;td&gt;Cel 2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cel 3&lt;/td&gt;&lt;td&gt;Cel 4&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;img src="/images/logotop.gif"&gt;&lt;br&gt;&lt;form&gt;&lt;input type="hidden"&gt;&lt;/form&gt;</textarea>
				<input type="button" value="Set HTML" onclick="SetHtml();" />
				<input type="button" value="Show HTML" onclick="ShowHtml();" />
				<input type="button" value="Focus" onclick="Focus();" />
				<span onmouseup="Focus();">Click this text to focus</span>
				&nbsp; &nbsp; &nbsp;
				<input id="xChkWYSIWYG" checked="checked" type="checkbox" />
				<label for="xChkWYSIWYG">
					WYSIWYG Mode</label>
			</td>
		</tr>
	</table>
</body>
</html>
